package alone.sub.table.test.demo.controller;

import alone.sub.table.test.demo.pojo.UserInfo;
import alone.sub.table.test.demo.service.UserInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/sub/table/test/")
public class UserInfoController {

    @Resource
    private UserInfoService userInfoService;

    /**
     * 分表插入
     * @param name name
     * @param password password
     * @return result
     */
    @PostMapping("signIn")
    public String signIn(@RequestParam("name") String name,@RequestParam("password") String password){
        return userInfoService.insertData(name,password);
    }

    /**
     * 分表查询
     * @param id id
     * @return userInfo
     */
    @GetMapping("getUserInfo")
    public UserInfo findUserInfo(Integer id){
        return userInfoService.findUserById(id);
    }

}
